class Solution
{
public:
    string reverseMessage(string message)
    {
        string ans = "", s;
        stringstream ss(message);
        while (ss >> s)
            ans = s + " " + ans;

        if (!ans.empty())
            ans.pop_back();
        return ans;
    }
};